package net.huashitong.supervision.task.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.supervision.task.dao.SMSDao;
import net.huashitong.supervision.task.entity.SMSEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/10/30
 * Time: 11:33
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
public class SMSService extends StringPKService<SMSEntity> {
    @Autowired
    private SMSDao smsDao;
    @Autowired
    private SysTableService tableService;
    @Override
    protected BaseDao<SMSEntity, String> getDao() {
        return smsDao;
    }

    @Override
    protected void beforeSave(SMSEntity obj) {
       obj.setSysId(tableService.updateMaxSysId("t_sms_entity",null ));
    }

    public List<SMSEntity> queryByState(String s) {
        return smsDao.getByState(s);
    }
}
